#!/usr/local/bin/rake
# Copyright (C) 2003-2010 Wang Pengcheng <wpc0000@gmail.com>
# , released under the MIT license
# You may obtain a template of the MIT License at
# http://www.opensource.org/licenses/mit-license.php
$KCODE = 'u'

desc 'Compile tex files'
task :default => :compile

OUTPUT='output'
def cm(cmd='xelatex', file='main')
  sh cmd, '--output-directory='+OUTPUT, file
end
desc 'Compile tex files'
task :compile do
  cm('xelatex', 'WPC-CV-CN')
  cm('xelatex', 'WPC-CV-EN')
end

def to_doc(file)
  sh 'latex2rtf', '-o', OUTPUT+'/main-doc.rtf', file
end

desc 'Compile to Word'
task :doc do
  to_doc('main-doc.tex')
end

desc 'Recompile Bib file'
task :bib do
  cm
  system 'bibtex', OUTPUT+'/main'
end

require 'script/hgrake'
